package com.czxy.test;

import com.czxy.config.SpringConfig;
import com.czxy.dao.ProductDao;
import com.czxy.dao.UserDao;
import com.czxy.service.ProductService;
import com.czxy.service.UserService;
import com.czxy.service.impl.ProductServiceImpl;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Demo01 {

    @Test
    public void mo7(){
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
        ProductService productService = (ProductService) applicationContext.getBean("productServiceImpl");
        productService.findAll();
    }

    @Test
    public void mo6(){
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
        ProductDao productDao = (ProductDao) applicationContext.getBean("productDaoImpl");
        productDao.findAll();
    }

    @Test
    public void m05(){
        ProductService service = new ProductServiceImpl();
        service.findAll();
    }

    @Test
    public void m04(){
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
        UserService userService = (UserService) applicationContext.getBean("us");
        userService.findAll();
    }


    @Test
    public  void m03(){
        UserService userService = new UserService();
        userService.findAll();
    }

    @Test
    public void m02(){
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
        UserDao userDao = (UserDao) applicationContext.getBean("ud");
        userDao.findAll();
    }

    @Test
    public void m01(){

        UserDao userDao = new UserDao();

        userDao.findAll();


    }

}
